/**
 * 文章请求相关模块
 */

import request from '@/utils/request'

export const getArticles = params =>{
    return request({
        method:'GET',
        url:'/app/v1_1/articles',
        params
    })
}


/**
 * 获取新闻文章详情
 */

export const getArticleChannels =articleId=>{
    return request({
        method:'GET',
        url:`/app/v1_0/articles/${articleId}`
    })
}

/**
 * 点赞文章
 */
export const dianChannels = target =>{
    return request({
        method:'POST',
        url:'/app/v1_0/article/likings',
        data:{
            target
        }
    })
}


/**
 * 取消对文章点赞
 */

export const deleteChannels =targetId=>{
    return request({
        method:'DELETE',
        url: `/app/v1_0/article/likings/${targetId}`
    })
}

/**
 * 收藏文章
 */
export const shouChannels = target => {
    return request({
        method: 'POST',
        url: '/app/v1_0/article/collections',
        data: {
            target
        }
    })
}


/**
 * 取消对文章收藏
 */

export const deleteShouChannels = targetId => {
    return request({
        method: 'DELETE',
        url: `/app/v1_0/article/collections/${targetId}`
    })
}